import request from '@/utils/request'

export interface userinfoModel { 
  avatar: string,
  name: string,
  buttons: string[],
  roles: string[],
  routes: string[]
}

interface tokenModel {
  token: string
}

interface loginModel {
  username: string,
  password: string
}

export default {
  //登录
  login(data: loginModel) {
    return request.post<any, tokenModel>(`/admin/acl/index/login`, data)
  },
  // 获取用户信息
  info() {
    return request.get<any, userinfoModel>(`/admin/acl/index/info`)
  },
  // 退出登录
  logout() {
    return request.post<any, null>(`/admin/acl/index/logout`)
  }
} 